package com.qz.mos.filter;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Component
@Slf4j
public class MyLogFilterFactory extends AbstractGatewayFilterFactory<MyLogFilterFactory.Config> {

    public MyLogFilterFactory() {
        super(Config.class);
    }

    @Override
    public GatewayFilter apply(Config config) {
        return new MyLogFilter();
    }

    @Override
    public String name() {
        return "MyLogFilter";
    }
    @Override
    public List<String> shortcutFieldOrder() {
        return Arrays.asList( "name", "path" );
    }
    @Data
    public static class Config {
        String name;
        String path;
    }

}